﻿using System.Collections.Generic;
using System.Linq;
using ReactiveGraph.Core;
using ReactiveGraph.Core.Extensions;
using ReactiveGraph.Extensions.Rules.Core;

namespace ReactiveGraph.Extensions.Rules
{
    public static class NodeRuleExtensions
    {
        public static void AttachRule(this IReactiveNode node, IDeclared<NodeEvent> rule)
        {
            node.Rules().Add(rule);
        }

        public static List<IDeclared<NodeEvent>> Rules(this IReactiveNode node)
        {
            return node.GetProperty(NodeRules.RulesPropertyName).Value as List<IDeclared<NodeEvent>>;
        }
    }
}
